export default {
    state:{
        // 用来控制导航菜单
        isCollapse:false,
        tabList:[
            {
                path: "/",
                name: "home",
                label: "首页",
                icon: "s-home",
                url: "Home/Home",
            },
        ]
    },
    mutations:{
        collapseMenu(state){
            // console.log(state.isCollapse);
            state.isCollapse = !state.isCollapse
        },
        // 添加面包屑数据
        selectMenu(state,value){
            // console.log(value);
            if(value.name !== 'home'){
               const index = state.tabList.findIndex(item=>item.name === value.name)
            // 不存在
            if(index=== -1){
                state.tabList.push(value)
            }
            }

        },
        // 删除数据
        closeTag(state,item){
            console.log(item);
           const index = state.tabList.findIndex(val=>val.name===item.name)
           state.tabList.splice(index,1)
        }
    }

}